<!--
 @description 帮助中心楼层内容楼层
 @fileName ContentItem.vue
 @author zengqiongying
 @created 2022/02/22 18:37:15
-->
<template>
  <div class="content-storey">
    <div v-for="(item,i) in list" :key="i" class="content-item" :class="{'single-item':layoutType==='singleContent'}" @click.stop="clickHandle(item)">
      <div class="item-img">
        <ImageVideo lazy-load :host="imgHost" :src="item.coverUrl" fit="contain" />
        <svg-icon v-if="item.contentType===2" icon-class="bofang-solid" class="icon-video" />
      </div>
      <div class="item-name">{{ item.contentTitle }}</div>
    </div>
  </div>
</template>

<script>
import ImageVideo from '@/components/ImageVideo'
export default {
  name: 'StoreyContentItem',
  components: { ImageVideo },
  props: {
    layoutType: {
      type: String,
      default: ''
    },
    list: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      imgHost: `${process.env.VUE_APP_STATIC}`
    }
  },

  computed: {},

  created() {},
  activated() {},

  mounted() {},

  methods: {
    clickHandle(item) {
      this.$router.push({ name: 'HelpCenterDetail', params: { id: item.contentId }, query: { c: item.categoryId }})
    }
  }
}

</script>
<style lang='less' scoped>
.content-storey{
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0 10px;
  box-sizing: border-box;
  .content-item{
    --width: calc(100vw - 40px - 15px);
    width:calc(var(--width)/2);
    margin-bottom:5px;
    &:nth-child(even){
      margin-left:15px;
    }
    .item-img{
      width: 100%;
      height: calc(var(--width)/2 * 110 / 160);
      // height: 110px;
      line-height: 0;
      border-radius:4px;
      // background: #f5f5f5;
      overflow: hidden;
      position: relative;
      .icon-video{
        position:absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
        font-size: 40px;
        color: rgba(255, 255, 255, .8);
      }
    }
    .item-name{
      width: 100%;
      min-height: 40px;
      line-height: 40px;
      // padding: 10px 0;
      font-size:14px;
      font-weight:500;
      color: #333;
      letter-spacing: 1px;
      // white-space: nowrap;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 1;
      overflow: hidden;
    }
    &.single-item{
      width: 100%;
      margin: 0 0 5px !important;
      .item-img{
        height: auto;
      }
    }
  }

}
</style>
